ConcurrentDictionary(TKey, TValue) Constructor (Int32, Int32)

Task Parallel System.Threading

Initializes a new instance of the ConcurrentDictionary<(Of <(TKey, TValue>)>) class that is empty, has the specified concurrency level and capacity, and uses the default comparer for the key type.

Namespace:  System.Collections.Concurrent
Assembly:  System.Threading (in System.Threading.dll)

Syntax

Visual Basic (Declaration)
Public Sub New ( _
	concurrencyLevel As Integer, _
	capacity As Integer _
)
C#
public ConcurrentDictionary(
	int concurrencyLevel,
	int capacity
)

Parameters

concurrencyLevel
Type: System..::.Int32
The estimated number of threads that will update the ConcurrentDictionary<(Of <(TKey, TValue>)>) concurrently.
capacity
Type: System..::.Int32
The initial number of elements that the ConcurrentDictionary<(Of <(TKey, TValue>)>) can contain.

Exceptions

ExceptionCondition
System..::.ArgumentOutOfRangeExceptionconcurrencyLevel is less than 1.
System..::.ArgumentOutOfRangeException capacity is less than 0.

See Also